package db

import "time"

// Basics 基础字段
type Basics struct {
	CreateDate *time.Time `gorm:"column:create_time;type:timestamp;"` //创建时间
	CreateUser uint64     `gorm:"column:creator_id;"`                 //创建人ID
	UpdateDate *time.Time `gorm:"column:update_time;type:timestamp;"` //更新时间
	UpdateUser uint64     `gorm:"column:operator_id"`                 //更新人ID
}

// SetCreateInfo 设置创建信息
func (b *Basics) SetCreateInfo(userID uint64) {
	now := time.Now()
	b.CreateUser = userID
	b.CreateDate = &now
	b.UpdateUser = userID
	b.UpdateDate = &now
	//b.Status = 1
}

// SetUpdateInfo 设置更新信息
func (b *Basics) SetUpdateInfo(userID uint64) {
	now := time.Now()
	b.UpdateUser = userID
	b.UpdateDate = &now
}
